<template>
	<view class="mainbgc" v-if="pageShow">
		<header-top :messageInfo="{typeFlag:true,message:'客户续费提醒'}"></header-top>
		<view class="mainpadding">
			<view class="content_top flexbetween">
				<view class="">
					共计：<text style="color: #3476fe;">{{list.total}}</text>
				</view>
			</view>
			<view class="margin_top right-content mainpadding ffffff radius" v-for="item in list.data" :key="item.id">
				<text class="strongtext">{{item.name}}<text class="smalltext">（{{item.intention.name}}）</text></text>
				<view class="flexbetween margin_top">
					<text>规模等级：<text class="strongtext">{{item.scalelevel.name || ""}}</text></text>
					<text>姓名：<text class="strongtext">{{item.khname || ""}}</text></text>
				</view>
				<view class="flexbetween margin_top">
					<!-- <text>注册时间：<text class="strongtext">{{item.create_time_text}}</text></text> -->
					<text>行业：<text class="strongtext">{{item.industry.name || ""}}</text></text>
				</view>
				<view class="flexbetween margin_top">
					<text>经营区域：<text class="strongtext">{{item.jyqy ||""}}</text></text>
					<view class="flexleft" @click.stop="phone(item.tel)">电话：<view class="strongtext flexleft">{{item.tel}}
							<view class="callphone"></view>
						</view>
					</view>
				</view>
				<view class="margin_top">
					<view class="flexleft" @click.stop="openlocation(item)">
						<view class="white_nowrap">地址：</view>
						<view class="strongtext yihang">{{item.cityinfo}}{{item.address_detail}}</view>
						<view class="addressicon"></view>
					</view>
				</view>
				<view class="margin_top">
					<view class="flexbetween">
						<text>套餐：<text class="strongtext">{{item.thaliinfo.thali_name}}</text></text>
						<text>到期天数：<text class="strongtext" style="color: red;">{{item.end_days || ""}}</text></text>
					</view>
				</view>
				<view class="flexright margin_top">
					<view class=" paybtn" @click.stop="jumpurlpay(item.id)">支付套餐</view>
					<!-- <view class="editbtn" @click.stop="jumpurledior(item.id)">编辑</view> -->
				</view>
				<!-- <view class="flexcenter margin_top timeouttext">合同还有到期{{item.days}}</view>
				<view class="flexcenter margin_top timeouttext" v-if="item.daoqi==1">合同已到期</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: [{
						address: "",
						createtime: 0,
						daoqi: 0,
						duankou: 0,
						gongsi: "",
						hangye: "",
						id: 0,
						jingying: null,
						mobile: "",
						name: "",
						tcid: 0,
						type: "",
					}]
				},
				pageShow:false
			}
		},
		onShow() {
			this.init()
		},
		filters: {
			// 时间戳处理
			formatDate: function(value, spe = '/') {
				value = value * 1000
				let data = new Date(value);
				let year = data.getFullYear();
				let month = data.getMonth() + 1;
				let day = data.getDate();
				let h = data.getHours();
				let mm = data.getMinutes();
				let s = data.getSeconds();
				month = month >= 10 ? month : "0" + month;
				day = day >= 10 ? day : "0" + day;
				h = h >= 10 ? h : "0" + h;
				mm = mm >= 10 ? mm : "0" + mm;
				s = s >= 10 ? s : "0" + s;
				return `${year}${spe}${month}${spe}${day}`;
			}
		},
		methods: {
			// 客户续费提醒列表数据
			init(isPage, page) {
				let _this = this
				httpRequest.request('/employeesapi/shop/shopList', 'GET', {
					page: page || 1,
					limit: _this.limit,
					endtime_sort:1
				}, false, false, true).then(res => {
					if (res.code == 1) {
						// res.data.data.forEach(item=>{
						// 	let address = item.dianpu.split("/")
						// 	item.dianpu = address.join("")
						// })
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							_this.list = resList
							_this.list.data = resList.data;
						}
						_this.pageShow=true
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			openlocation(item){
				uni.openLocation({
				     latitude: Number(item.lat),//即将传到高德或腾讯地图的终点纬度  必须是数值，字符串无效
				     longitude:Number(item.lng),//即将传到高德或腾讯地图的终点经度  必须是数值，字符串无效
				     name: item.address,//即将传到高德或腾讯地图的店铺名称
				     address: item.dianpu+item.address,//即将传到高德或腾讯地图的详细地址
				     scale: 18
				})
			},
			// 打电话
			phone(p) {
				uni.makePhoneCall({
					phoneNumber: p.toString()
				}).catch((e) => {
					// console.log(e)  //用catch(e)来捕获错误{makePhoneCall:fail cancel}
				})
			},
			jumpurlpay(id) {
				uni.navigateTo({
					url: '/pages/taocanzf/taocanzf?id=' + id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.paybtn {
		padding: 10rpx 40rpx;
		color: #fff;
		border: 1rpx solid #3476fe;
		background-color: #3476fe;
		border-radius: 50rpx;
		font-size: 36rpx;
	}
	.content_top {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #999999;
		flex-wrap: wrap;
		padding: 0 30rpx;
	}
	.right-content {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.strongtext {
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: 800;
		color: #333333;
	}

	.smalltext {
		font-size: 26rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #333333;
	}

	.timeouttext {
		font-size: 36rpx;
		font-family: PingFang SC;
		font-weight: 500;
		color: #FF0000;
	}
</style>
